#!/usr/bin/python
#encoding=utf-8
from renren import *
import getpass
ren=Renren()
while True:
	print "input your name:"
	username=raw_input()
	print "input your paassword"
	password=getpass.getpass("password:")
	domain='renren.com'
	origURL='http://www.renren.com/home'
	#人人网信息初始化
	ren.setinfo(username,password,domain,origURL)
	#人人网登录
	if not ren.login():
		break
#获取好友列表，并存为friendlist.dat文件于当前目录，此函数运行一次即可
#注释掉
ren.getfriendlist()
#按名字搜索好友的id
while True:
	print "input name of your friend:"
	result=ren.getfriendid(raw_input())
	i=0
	for key in result.keys():
		print i,": ",key,result[key]
		i=i+1
	print "q for next"
	if raw_input()=='q':
		break
#手动写入id，下载相册，下载于当前目录，注意要求是好友的id
print "input id of your friend:"
ren.getphotos(result.keys()[int(raw_input())])
print "Done!"


